<!DOCTYPE html>
<html>
<head>
    <title>new实现</title>
    <script src="../../src/object/newInstance.js"></script>
</head>
<body>
    <script>
        function Person(name, age) {
            this.name = name;
            this.age = age;
        }

        Person.prototype.sayName = function() {
            console.log(this.name);
        }

        var person = newInstance(Person, '张三', 20);
        console.log(person.name); // 张三
        console.log(person.age); // 20
        person.sayName(); // 张三
    </script>
</html>